package com.zhuyuan.core.constant;

/**
 * @Author: 张琳凯
 * @Description: 认证相关常量
 * @DateTime: 2025/1/9 18:01
 **/
public class Oauth2Constants {

    /**
     * 秘钥串
     */
    public static final String SIGNING_KEY = "zhuyuan";
    /**
     * header中token的key
     */
    public static final String HEADER_TOKEN_KEY = "Authorization";
    /**
     * token的前缀
     */
    public static final String AUTHORIZATION_BEARER = "Bearer";
    /**
     * 客户端-表名
     */
    public static final String CLIENT_TABLE = "oauth_client_details";
    /**
     * 基础查询语句
     */
    public static final String CLIENT_BASE = "select client_id, client_secret, resource_ids, scope, " +
            "authorized_grant_types, web_server_redirect_uri, authorities, access_token_validity," +
            "refresh_token_validity, additional_information, autoapprove from " + CLIENT_TABLE;

    public static final String FIND_CLIENT_DETAIL_SQL = CLIENT_BASE + " order by client_id";

    public static final String SELECT_CLIENT_DETAIL_SQL = CLIENT_BASE + " where client_id = ?";
    //================================登录===============================
    /**
     * @description: 登录提交用户名的参数名
     **/
    public static final String USERNAME = "username";
    /**
     * @description: 登录提交密码的参数名
     **/
    public static final String PASSWORD = "password";

    //-------------账号-密码-验证码-模式---------------
    /**
     * @description: grant type,登录模式，与客户端配置中的grant type对应
     **/
    public static final String CAPTCHA_GRANT_TYPE = "captcha";
    /**
     * @description: 生成的验证码存储在Redis中的key标志
     * key格式：REDIS_CAPTCHA_KEY+UUID
     * 获取验证码：1.生成uuid,2.保存到redis,3.请求添加返回的uuid
     **/
    public static final String REDIS_CAPTCHA_KEY = "captcha.code.";
    /**
     * @description: 提交时，验证码Key的参数名
     **/
    public static final String CAPTCHA_HEADER_KEY = "captchaKey";
    /**
     * @description: 提交时，验证码的参数名
     **/
    public static final String CAPTCHA_HEADER_CODE = "captchaCode";
    //-------------手机号-验证码-模式---------------
    /**
     * @description: grant type,手机验证码模式，与客户端配置中的grant type对应
     **/
    public static final String SMS_GRANT_TYPE = "sms";
    /**
     * @description: 生成的验证码存储在Redis中的key标志
     * key格式：REDIS_CAPTCHA_KEY+手机号
     **/
    public static final String REDIS_SMS_KEY = "sms.code.";
    /**
     * @description: 提交时，验证码Key的参数名
     **/
    public static final String SMS_HEADER_KEY = "smsKey";
    /**
     * @description: 提交时，验证码的参数名
     **/
    public static final String SMS_HEADER_CODE = "smsCode";
    //-------------第三方-模式---------------
    /**
     * @description: grant type,手机验证码模式，与客户端配置中的grant type对应
     **/
    public static final String SOCIAL_GRANT_TYPE = "social";
    /**
     * @description: 生成的验证码存储在Redis中的key标志
     * key格式：REDIS_CAPTCHA_KEY+手机号
     **/
    public static final String REDIS_SOCIAL_KEY = "SOCIAL::STATE::";
    /**
     * @description: 提交时，验证码Key的参数名
     **/
    public static final String SOCIAL_HEADER_CODE = "code";
    /**
     * @description: 提交时，验证码的参数名
     **/
    public static final String SOCIAL_HEADER_STATE = "state";


//    ----------------------------
    public static final String REDIS_USER_AUTHORITIES_CODE = "authorities.code.";

}
